<%@ Import namespace="MIMS.WRS.Entities" %>
<%@ Import namespace="MIMS_WRS.Web" %>
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="ShoppingCartList.aspx.vb" Inherits="MIMS_WRS.Web.ShoppingCartList"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
	<HEAD>
		<title>IDS - Shopping Cart</title>
		<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
		<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
		<meta content="JavaScript" name="vs_defaultClientScript">
		<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
		<LINK href="../startpage.css" type="text/css" rel="stylesheet">
		<script language="javascript" src="../js/common.js"></script>
		<style>
			tooltipheader { BORDER-RIGHT: #c4d5e3 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #c4d5e3 1px solid; PADDING-LEFT: 5px; FONT-WEIGHT: bold; FONT-SIZE: 11px; BACKGROUND: #c4d5e3; FILTER: alpha(opacity=85); PADDING-BOTTOM: 5px; BORDER-LEFT: #c4d5e3 1px solid; WIDTH: 400px; PADDING-TOP: 5px; BORDER-BOTTOM: #c4d5e3 1px solid; FONT-FAMILY: tahoma, arial; opacity: 0.85; -moz-opacity: 0.85 }
			.tooltipbody { BORDER-RIGHT: #c4d5e3 1px solid; PADDING-RIGHT: 8px; PADDING-LEFT: 8px; FONT-SIZE: 11px; BACKGROUND: #fff; FILTER: alpha(opacity=85); PADDING-BOTTOM: 8px; BORDER-LEFT: #c4d5e3 1px solid; WIDTH: 400px; PADDING-TOP: 8px; BORDER-BOTTOM: #c4d5e3 1px solid; FONT-FAMILY: tahoma, arial; opacity: 0.85; -moz-opacity: 0.85 }
			.tooltiph1 { FONT-WEIGHT: bold; TEXT-DECORATION: underline }
			DIV#subHeader { PADDING-RIGHT: 3px; PADDING-LEFT: 3px; FONT-SIZE: 8pt; PADDING-BOTTOM: 3px; COLOR: white; PADDING-TOP: 3px; FONT-FAMILY: Tahoma, Arial, verdana; HEIGHT: 2%; BACKGROUND-COLOR: #64a2de }
			DIV#header { VERTICAL-ALIGN: top; HEIGHT: 5%; BACKGROUND-COLOR: #eeeeee }
			DIV#header H1 { PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 1.4em; FLOAT: left; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: blue; PADDING-TOP: 0px }
			DIV#header #navigation { CLEAR: left; PADDING-RIGHT: 0.3em; FLOAT: right; VERTICAL-ALIGN: top }
			#tblList table
			{
				border-collapse: collapse;				
				background-color: WhiteSmoke;
			}
			#tblList td 
			{
				border-top: 0px solid black;
				border-left: 0px solid #DDD;	
				cursor: hand;	
			}

			#tblList td, th
			{	
				white-space: nowrap;
				padding-left: 2px;
				padding-right: 2px;
				text-align: left;
				font-size: 11px;
			}
			#tblList th
			{
				font-weight: normal;
				font-size: 0.8em;
				font-family: verdana, Arial, tahoma, sans-serif;
				color: #3A4F6C;
				background-color: #CFD9E7;	
				border-bottom: 0px solid #222;	
				text-align: center;	
				border-left: 0px solid #222;	
				overflow: hidden;
				text-overflow: ellipsis;
				display: block;	
			}

			#tblList table tbody tr td div 
			{
				overflow: hidden;
				text-overflow: ellipsis;
				display: block;	
			}
			.ItemRow
			{
				background: #F0F0F0;
			}

			.AlternateItemRow
			{
				background: #FAFAFA;
			}

			.RowSelected
			{
				background-color: #9B9B1C;
				color: #FFF;	
			}
			.CellWidth1 { WIDTH: 5% }
			.CellWidth11 { WIDTH: 6% }
			.CellWidth2 { WIDTH: 10% }
			.CellWidth3 { WIDTH: 18% }
			.CellWidth4 { WIDTH: 8% }
			.CellWidth5 { WIDTH: 12% }
			.CellWidth6 { WIDTH: 8% }
			.CellWidth7 { WIDTH: 11% }
			.CellWidth8 {WIDTH: 10%}
			.CellWidth9 { WIDTH: 8% }
			.CellWidth10 { WIDTH: 8% }
			.ReadOnlyTextbox { COLOR: #0000cc }
			
			.TextBoxNumber
			{
				text-align: right;
			}
		</style>
		<script language="javascript" type="text/javascript">
			function ConfirmMessage(isSavedData)
			{
				if(isSavedData=='')
				{
					alert('There is no data to clean up!');
					return false;
				}
				return confirm("Are you sure you want to delete your saved list and go Back to IDS?");
			}
			function HandleTypeOrderClick()
			{
				HandleTypeOrder();
				
				document.getElementById("txtSelectVolumeTotal").value = "";
				document.getElementById("txtPercentFull").value = "";
				document.getElementById("txtRemainVolume").value = "";
				
				document.getElementById("txtTotalGoodWeight").value = "";
				document.getElementById("txtGoodWeightPercentFull").value = "";
				document.getElementById("txtGoodWeightRemain").value = "";
				
				CustomBackGroundColor();
			}
			
			function CustomBackGroundColor()
			{
				/*If the Half Pallet spaces option is selected then :
					- the % Full is not working
					- the weight is showing greyed out (also Total Value and % Full (volume) also looks greyed out) 
					*/
				document.getElementById("txtSelectVolumeTotal").style.backgroundColor = 'ffffff';
				document.getElementById("txtPercentFull").style.backgroundColor = 'ffffff';
				document.getElementById("txtTotalGoodWeight").style.backgroundColor = 'ffffff';
				
				var rdFullContainer = document.getElementById("rdFullContainer");
				if(rdFullContainer.checked == false){
					var radHalfPallet = document.getElementById("radHalfPallet");
					if(radHalfPallet.checked == true)
					{
						//document.getElementById("txtSelectVolumeTotal").style.backgroundColor = 'WhiteSmoke';
						//document.getElementById("txtPercentFull").style.backgroundColor = 'WhiteSmoke';
						//document.getElementById("txtTotalGoodWeight").style.backgroundColor = 'WhiteSmoke';
					}
				}
			}
			
			function HandleExistingOrderOptionSelectionClick()
			{
				CustomBackGroundColor();
				HandleExistingOrderOptionSelection();
				/*If the Half Pallet spaces option is selected then :
				- the % Full is not working
				- the weight is showing greyed out (also Total Value and % Full (volume) also looks greyed out) 
				*/
				var rdFullContainer = document.getElementById("rdFullContainer");
				if(rdFullContainer.checked == false){
					var radHalfPallet = document.getElementById("radHalfPallet");
					if(radHalfPallet.checked == true)
					{
						//document.getElementById("txtSelectVolumeTotal").value = "";
						//document.getElementById("txtPercentFull").value = "";
						//document.getElementById("txtTotalGoodWeight").value = "";
						document.getElementById("txtGoodWeightPercentFull").value = "";
						document.getElementById("txtGoodWeightRemain").value = "";
						if (!(document.getElementById("txtHalfPallet").value.length >0))
						{
							document.getElementById("txtRemainVolume").value = "";
						}
					}
					else
					{
						/* If the volume is selected :
							- the pallet spaces should be emptied
							- the volume needed to fill is not appearing in Remaining Volume and then % Full needs to be calculated on these figures.
							*/
						document.getElementById("txtHalfPallet").value = "";
					}
				}
			}
			
			function HandleTypeOrder(){
			
				HandleExistingOrderOptionSelectionClick();
				var rdPartOrder = document.getElementById("rdPartOrder");
				var rdFullContainer = document.getElementById("rdFullContainer");
				
				CalQty20Cont(document.getElementById("txtQty20Cont"));
				CalQty40Cont(document.getElementById("txtQty40Cont"));
				CalQty40HiCube(document.getElementById("txtQty40HiCube"));
				
				//default background color
				document.getElementById("txtSelectVolumeTotal").style.backgroundColor = 'ffffff';
				document.getElementById("txtPercentFull").style.backgroundColor = 'ffffff';
				document.getElementById("txtTotalGoodWeight").style.backgroundColor = 'ffffff';
				
				if(rdFullContainer.checked == true){
					document.getElementById("trLine7").style.visibility = "hidden";
					document.getElementById("trLine7").style.display = "none";
					document.getElementById("trLine71").style.visibility = "hidden";
					document.getElementById("trLine71").style.display = "none";
					
					document.getElementById("trLine8").style.visibility = "";
					document.getElementById("trLine8").style.display = "block";
					document.getElementById("trLine9").style.visibility = "";
					document.getElementById("trLine9").style.display = "block";
					document.getElementById("trLine91").style.visibility = "";
					document.getElementById("trLine91").style.display = "block";
					//document.getElementById("trLine11").style.visibility = "";
					//document.getElementById("trLine11").style.display = "block";
					
					document.getElementById("trLine10").style.height = "25";
					//document.getElementById("lblTerritory").style.visibility = "hidden";
					//document.getElementById("lblTerritory").style.display = "none";
					
					document.getElementById("txtGoodWeightPercentFull").style.visibility = "";
					document.getElementById("txtGoodWeightPercentFull").style.display = "block";
					document.getElementById("txtGoodWeightRemain").style.visibility = "";
					document.getElementById("txtGoodWeightRemain").style.display = "block";
					document.getElementById("lblRemainingWeight").style.visibility = "";
					document.getElementById("lblRemainingWeight").style.display = "block";
					document.getElementById("lblPercentFull").style.visibility = "";
					document.getElementById("lblPercentFull").style.display = "block";
					document.getElementById("lblMeasUnitGoodWeightRemain").style.visibility = "";
					document.getElementById("lblMeasUnitGoodWeightRemain").style.display = "block";
					
					document.getElementById("txtHalfPallet").value = "";
					document.getElementById("txtExistingOrderVolume").value = "";
					//document.getElementById("txtRemainVolume").value = "";
					
					GetTotal();
				}
				else{
					document.getElementById("trLine7").style.visibility = "";
					document.getElementById("trLine7").style.display = "block";
					document.getElementById("trLine71").style.visibility = "";
					document.getElementById("trLine71").style.display = "block";
					
					document.getElementById("trLine8").style.visibility = "hidden";
					document.getElementById("trLine8").style.display = "none";
					document.getElementById("trLine9").style.visibility = "hidden";
					document.getElementById("trLine9").style.display = "none";
					document.getElementById("trLine91").style.visibility = "hidden";
					document.getElementById("trLine91").style.display = "none";
					//document.getElementById("trLine11").style.visibility = "hidden";
					//document.getElementById("trLine11").style.display = "none";
					
					document.getElementById("trLine10").style.height = "70";
					//document.getElementById("lblTerritory").style.visibility = "";
					//document.getElementById("lblTerritory").style.display = "block";
					
					document.getElementById("txtGoodWeightPercentFull").style.visibility = "hidden";
					document.getElementById("txtGoodWeightPercentFull").style.display = "none";
					document.getElementById("txtGoodWeightRemain").style.visibility = "hidden";
					document.getElementById("txtGoodWeightRemain").style.display = "none";
					document.getElementById("lblRemainingWeight").style.visibility = "hidden";
					document.getElementById("lblRemainingWeight").style.display = "none";
					document.getElementById("lblPercentFull").style.visibility = "hidden";
					document.getElementById("lblPercentFull").style.display = "none";
					document.getElementById("lblMeasUnitGoodWeightRemain").style.visibility = "hidden";
					document.getElementById("lblMeasUnitGoodWeightRemain").style.display = "none";
				}
				CustomBackGroundColor();
			}
			function CalQty20Cont(txtQty20Cont){
				var measUnit = document.getElementById("hidMeasUnit").value;
				var unit20;
				switch (measUnit)
				{
					case "cu ft":
						unit20 = 30 * 35.314;//35 * 35.314;
						break;
					case "cbm":
						unit20 = document.getElementById("hid20C").value;
						break;
					default:
						unit20 = 30;
				}
							
				if(txtQty20Cont.value.length >0){
					var s = new String();
					s = NumberFormatted(Math.round(txtQty20Cont.value * unit20));
					document.getElementById("txtVolumeUnit20").value  = CommaFormattedForNumber(s);
					//document.getElementById("txtVolumeUnit20").value = Math.round(txtQty20Cont.value * unit20);
				}
				else{
					document.getElementById("txtVolumeUnit20").value = "";
				}
				
				
				GetTotal();
			}
			function CalQty40Cont(txtQty40Cont){
				var measUnit = document.getElementById("hidMeasUnit").value;
				var unit40;
				switch (measUnit)
				{
					case "cu ft":
						unit40 = 60* 35.314;//70 * 35.314;
						break;
					case "cbm":
						unit40 = document.getElementById("hid40C").value;
						break;
					default:
						unit40 = 60;
				}
				
				if(txtQty40Cont.value.length >0){
					var s = new String();
					s = NumberFormatted(Math.round(txtQty40Cont.value * unit40));
					document.getElementById("txtVolumeUnit40").value  = CommaFormattedForNumber(s);
					//document.getElementById("txtVolumeUnit40").value = Math.round(txtQty40Cont.value * unit40);
				}
				else{
					document.getElementById("txtVolumeUnit40").value = "";
				}
				GetTotal();
			}
			
			function CalQty40HiCube(txtQty40HiCube){
				var measUnit = document.getElementById("hidMeasUnit").value;
				var unit40HiCube;
				switch (measUnit)
				{
					case "cu ft":
						unit40HiCube = 76* 35.314;//80 * 35.314;
						break;
					case "cbm":
						unit40HiCube = document.getElementById("hid40HC").value;
						break;
					default:
						unit40HiCube = 76;
				}
				
				if(txtQty40HiCube.value.length >0){
					var s = new String();
					s = NumberFormatted(Math.round(txtQty40HiCube.value * unit40HiCube));
					document.getElementById("txtVolumeUnit40HiCube").value  = CommaFormattedForNumber(s);
					//document.getElementById("txtVolumeUnit40HiCube").value = Math.round(txtQty40HiCube.value * unit40HiCube);
				}
				else{
					document.getElementById("txtVolumeUnit40HiCube").value = "";
				}
				
				GetTotal();
			}
			
			function GetTotal(){
				var txtVolumeUnit20 = document.getElementById("txtVolumeUnit20");
				var txtVolumeUnit40 = document.getElementById("txtVolumeUnit40");
				var txtVolumeUnit40HiCube = document.getElementById("txtVolumeUnit40HiCube");
				var txtTotalVolumeAvailable = document.getElementById("txtTotalVolumeAvailable");
				var txtTotalWeightAvailable = document.getElementById("txtTotalWeightAvailable");
				var txtQty20Cont = document.getElementById("txtQty20Cont");
				var txtQty40Cont = document.getElementById("txtQty40Cont");
				var txtQty40HiCube = document.getElementById("txtQty40HiCube");
				var total = 0 ;
				var totalWeight = 0 ;
				var hidRoadWeight = document.getElementById("hidRoadWeight");
				
				if(hidRoadWeight.value.length <=0){
					hidRoadWeight.value = 1;
				}
				if(txtVolumeUnit20.value.length >0){
					total = Number(txtVolumeUnit20.value.replace(',',''))*1;
					totalWeight = txtQty20Cont.value*hidRoadWeight.value*1;
				}
				if(txtVolumeUnit40.value.length >0){
					total=  total + Number(txtVolumeUnit40.value.replace(',',''))*1;
					totalWeight = totalWeight + txtQty40Cont.value*hidRoadWeight.value*1;
				}
				if(txtVolumeUnit40HiCube.value.length >0){
					total = total + Number(txtVolumeUnit40HiCube.value.replace(',',''))*1;
					totalWeight = totalWeight + txtQty40HiCube.value*hidRoadWeight.value*1;
				}
				var s = new String();
				
				s = CurrencyFormatted(total);
				txtTotalVolumeAvailable.value = CurrencyFormatted(s);
				
				s = new String();
				s = CurrencyFormatted(totalWeight);
				var valueOfTotalWeight = CommaFormatted(s);
				if(valueOfTotalWeight.indexOf('.') > 0)
					txtTotalWeightAvailable.value = valueOfTotalWeight.substr(0,valueOfTotalWeight.indexOf('.'));
				else
					txtTotalWeightAvailable.value = valueOfTotalWeight;
			}
			
			function openAddNotesDialog(prouctCodeOrder) {
				
				var url = '../Stock/AddNotesForShoppingCart.aspx?index=' + prouctCodeOrder;
				var title = escape('Add Notes');
				var height = 200;
				var width = 500;
				var iTop = (screen.height-height-30)/2;
				var iLeft = (screen.width-width)- 30;
				
				var returnValue =  window.showModalDialog('../Dialogs/ShowDialog.aspx?title=' + title + '&src=' + url, '', 'dialogLeft: ' +iLeft+ 'px; dialogTop:' + iTop+ 'px; dialogHeight: ' + height + 'px; dialogWidth: ' + width + 'px; center: no; resizable: no; scroll: no; status: no;');
				if(returnValue == '1')
				{
					__doPostBack("refresh", "");
				}
				return false;
			}
			
			function CheckFourDecimalNumber(id)
			{
				var value = document.getElementById(id).value;
				if ((value.indexOf('.') != -1)  && (value.indexOf('.') < (value.length - 5)))
					document.getElementById(id).value = value.substring(0, value.indexOf('.') + 5);
				
			}

			function HandleExistingOrderOptionSelection()
			{
				var radHalfPallet = document.getElementById("radHalfPallet");
				if(radHalfPallet.checked == true)
				{
					document.getElementById("txtHalfPallet").disabled = "";
					document.getElementById("txtExistingOrderVolume").disabled = "true";
				}
				else
				{
					document.getElementById("txtHalfPallet").disabled = "true";
					document.getElementById("txtExistingOrderVolume").disabled = "";
				}
			}
			
			function openCreateShoppingUserDialog() {
				var url = '../Stock/CreateShoppingUser.aspx';
				var title = escape('Create Shopping User');
				var height = 200;
				var width = 500;
				var iTop = (screen.height-height-30)/2;
				var iLeft = (screen.width/2) -100;
				var returnValue =  window.showModalDialog('../Dialogs/ShowDialog.aspx?title=' + title + '&src=' + url, '', 'dialogLeft: ' +iLeft+ 'px; dialogTop:' + iTop+ 'px; dialogHeight: ' + height + 'px; dialogWidth: ' + width + 'px; center: no; resizable: no; scroll: no; status: no;');
				if(returnValue == '1')
				{
					__doPostBack("saveList", "");
				}
				if(returnValue == '2') // Add items to the existed list
				{
					__doPostBack("saveListAddMoreItems", "");
				}
				if(returnValue == '3') // Add items to the existed list
				{
					__doPostBack("saveListByReplace", "");
				}
				return false;
			}
			
			function openConfirmToOverwriteOrAddToExistedListDialog(ConPointID,userid,useremail) {
				var url = '../Stock/ConfirmToOverwriteOrAddToExistedList.aspx?ConPointID=' + ConPointID+ "&userid=" +userid + '&useremail='+ useremail;
				var title = escape('Confirmation');
				var height = 200;
				var width = 500;
				var iTop = (screen.height-height-30)/2;
				var iLeft = (screen.width/2) -100;
				var returnValue =  window.showModalDialog('../Dialogs/ShowDialog.aspx?title=' + title + '&src=' + url, '', 'dialogLeft: ' +iLeft+ 'px; dialogTop:' + iTop+ 'px; dialogHeight: ' + height + 'px; dialogWidth: ' + width + 'px; center: no; resizable: no; scroll: no; status: no;');
				if(returnValue == '1')
				{
					__doPostBack("saveList", "");
				}
				if(returnValue == '2') // Add items to the existed list
				{
					__doPostBack("saveListAddMoreItems", "");
				}
				if(returnValue == '3') // Add items to the existed list
				{
					__doPostBack("saveListByReplace", "");
				}
				return false;
			}
			
			
			function openCreateShoppingUserDialogForSignInOther() {
				if(confirm("Sign in with other account will lose what you have just selected (if have). Are you sure you want to do?"))
				{
					var url = '../Stock/UserSignIn.aspx?from=SignInOther';
					var title = escape('Sign In');
					var height = 200;
					var width = 500;
					var iTop = (screen.height-height-30)/2;
					var iLeft = (screen.width/2 -100);
					
					var returnValue =  window.showModalDialog('../Dialogs/ShowDialog.aspx?title=' + title + '&src=' + url, '', 'dialogLeft: ' +iLeft+ 'px; dialogTop:' + iTop+ 'px; dialogHeight: ' + height + 'px; dialogWidth: ' + width + 'px; center: no; resizable: no; scroll: no; status: no;');
					if(returnValue == '1')
					{
						__doPostBack("reload","");
						return true;
					}
					return false;
				}
			}
			
			function FormatValues()
			{
				var txtSelectVolumeTotal = document.getElementById("txtSelectVolumeTotal");
				if(txtSelectVolumeTotal != null)
				{
					var s = new String();
					s = CurrencyFormatted(txtSelectVolumeTotal.value);
					var selectVolumeTotal = CommaFormatted(s);
					if(txtSelectVolumeTotal.value.indexOf('-') == 0 && selectVolumeTotal.indexOf('-') == -1)
					{
						txtSelectVolumeTotal.value = '-' +  selectVolumeTotal;
					}
					else
						txtSelectVolumeTotal.value = selectVolumeTotal;
				}
				
				var txtPercentFull = document.getElementById("txtPercentFull");
				s = new String();
				s = CurrencyFormatted(txtPercentFull.value);
				txtPercentFull.value = CommaFormatted(s);
				
				var txtRemainVolume = document.getElementById("txtRemainVolume");
				if(txtRemainVolume != null)
				{
					s = new String();
					s = CurrencyFormatted(txtRemainVolume.value);
					var remainVolume = CommaFormatted(s);
					if(txtRemainVolume.value.indexOf('-') == 0 && remainVolume.indexOf('-') == -1)
					{
						txtRemainVolume.value = '-' +  remainVolume;
					}
					else
						txtRemainVolume.value = remainVolume;
				}
				
				var txtTotalGoodWeight = document.getElementById("txtTotalGoodWeight");
				s = new String();
				s = CurrencyFormatted(txtTotalGoodWeight.value);
				var totalGoodWeightValues = CommaFormatted(s);
				if(totalGoodWeightValues.indexOf('.') > 0)
					txtTotalGoodWeight.value = totalGoodWeightValues.substr(0,totalGoodWeightValues.indexOf('.'));
				else
					txtTotalGoodWeight.value = totalGoodWeightValues;
					
				
				var txtGoodWeightPercentFull = document.getElementById("txtGoodWeightPercentFull");
				s = new String();
				s = CurrencyFormatted(txtGoodWeightPercentFull.value);
				txtGoodWeightPercentFull.value = CommaFormatted(s);
				
				var txtGoodWeightRemain = document.getElementById("txtGoodWeightRemain");
				if(txtGoodWeightRemain != null)
				{
					s = new String();
					s = CurrencyFormatted(txtGoodWeightRemain.value);
					var goodWeightRemainValues = CommaFormatted(s);
					if(goodWeightRemainValues.indexOf('.') > 0)
						txtGoodWeightRemain.value = goodWeightRemainValues.substr(0,goodWeightRemainValues.indexOf('.'));
					else
						txtGoodWeightRemain.value = goodWeightRemainValues;
				}
			}
			
								
			function ShowGuideInfo(index)
			{
				var url = '../Stock/DisplayGuidance.aspx?index=' + index ;
				var title = escape('Display guidance');
				var height = 200;
				var width = 500;
				var iTop = (screen.height-height-30)/2;
				var iLeft = (screen.width/2) -100;
				
				 window.showModalDialog('../Dialogs/ShowDialog.aspx?title=' + title + '&src=' + url, '', 'dialogLeft: ' +iLeft+ 'px; dialogTop:' + iTop+ 'px; dialogHeight: ' + height + 'px; dialogWidth: ' + width + 'px; center: no; resizable: no; scroll: no; status: no;');
				return false;
			}
			
			function openChangePasswordDialog() {
				var url = '../Stock/ChangePassword1.aspx';
				var title = escape('Change Password');
				var height = 240;
				var width = 500;
				var iTop = (screen.height-height-30)/2;
				var iLeft = (screen.width/2 -100);
				
				var returnValue =  window.showModalDialog('../Dialogs/ShowDialog.aspx?title=' + title + '&src=' + url, '', 'dialogLeft: ' +iLeft+ 'px; dialogTop:' + iTop+ 'px; dialogHeight: ' + height + 'px; dialogWidth: ' + width + 'px; center: no; resizable: no; scroll: no; status: no;');
				if(returnValue == '1')
				{
					return true;
				}
				return false;
			}
			
			function openSelectionConPointScreen()
			{
				var url = '../Stock/ConPointSelection.aspx';
					var title = escape('Consolidation Point selection');
					var height = 200;
					var width = 500;
					var iTop = (screen.height-height-30)/2;
					var iLeft = (screen.width/2 -100);
					
					var returnValue =  window.showModalDialog('../Dialogs/ShowDialog.aspx?title=' + title + '&src=' + url, '', 'dialogLeft: ' +iLeft+ 'px; dialogTop:' + iTop+ 'px; dialogHeight: ' + height + 'px; dialogWidth: ' + width + 'px; center: no; resizable: no; scroll: no; status: no;');
					if(returnValue == '1')
					{
						__doPostBack("reload","");
						return true;
					}
					return false;
			}
		</script>
	</HEAD>
	<body onload="HandleTypeOrder();HandleExistingOrderOptionSelection();FormatValues();">
	<form id="form1" method="post" runat="server">
		<div id="outerDiv">
			<div id="header">
				<h1  style="padding-left:109px">IDS - Shopping Cart - Assemble your Container</h1>
				<div id="navigation">
				<asp:linkbutton id="lnkBackToIDS" Runat="server" >Back to IDS</asp:linkbutton>
					&nbsp;|&nbsp;<A href="../Logon.aspx?logout=1">Log out</A></div>
			</div>
			<div id="loggedInSection" runat="server" style="FLOAT: right; WIDTH: 100%; PADDING-TOP: 5px;  TEXT-ALIGN: right">
			<asp:Label ID="lblEmailLoggedIn" Runat="server" Font-Size="11pt"> You are logged in using email </asp:Label>
			<asp:Label ID="lblEmail" Runat="server" Font-Size="11pt" Font-Bold="True"></asp:Label>
			<a id="linkChangePassword" href="#" onclick="openChangePasswordDialog();">
				Change password</a><br>&nbsp;&nbsp;<asp:Linkbutton Runat="server" ID="lnkNotUseSignedInAccount" Visible="False">Not used the account</asp:Linkbutton><a id="linkSignInwithOther" href="#"  onclick="openCreateShoppingUserDialogForSignInOther();" style="FONT-SIZE: 11pt;display:none">Sign in with 
				other.</a> 
				</div>
			<div id="content" style="WIDTH: 1050px; HEIGHT: 85%">
					<table id="mainTable" width="100%" border="0">
						<TBODY>
							<tr>
								<td><asp:label id="lblMessage" Runat="server" CssClass="ErrorMessage" EnableViewState="False"></asp:label></td>
							</tr>
							<tr>
								<td><asp:label id="lblInformation" Runat="server"></asp:label></td>
							</tr>
							<tr>
							<td>
								<table width="100%" border="0">
								<tr>
								<td style="width:78%">
									<span style="FONT-WEIGHT: bold; font-size:10pt" >Destination Country: </span> 
									<asp:DropDownList Font-Size="10pt" ID="ddlCountry" Runat="server" DataValueField="Value" DataTextField ="Text" OnSelectedIndexChanged="ddlCountry_OnSelectedIndexChanged" AutoPostBack="True"></asp:DropDownList>
									<span style="font-size:10pt" >&nbsp;from&nbsp;</span> 
									<span style="FONT-WEIGHT: bold; font-size:10pt" >Consolidation Point: </span><asp:label id="lblConsolidationText" Runat="server" Font-Size="10pt"></asp:label>
								</td>
								<td style="width:22%">
									<div id="divChangeConPoint" runat="server" style="FLOAT: left; PADDING-TOP: 1px; "><a id="linkChangeConPoint" href="#"  onclick="openSelectionConPointScreen();" style="FONT-SIZE: 10pt;">Change consolidation point</a> </div>
								</td>
								</tr>
								</table>
							</td>
							</tr>
							<tr>
								<td><span style="FONT-WEIGHT: bold; COLOR: blue;font-size:11pt" >Select: </span> This order
									<asp:RadioButton ID="rdFullContainer" Runat="server" Text=" is for a full container of goods all selected from the IDS"
										GroupName="order1" onclick="HandleTypeOrderClick()" Checked="True"></asp:RadioButton><span style="FONT-WEIGHT: bold; COLOR: blue;font-size:11pt" > OR </span><asp:RadioButton onclick="HandleTypeOrderClick()" ID="rdPartOrder" Runat="server" Text="Forms part of a existing production order"
										GroupName="order1"></asp:RadioButton>
								</td>
							</tr>
							<tr id="trLine7">
								<td><span>Enter our Order No if known:&nbsp;
										<asp:textbox id="txtOrderNo" Runat="server" Columns="8"></asp:textbox>&nbsp;<a href="#" onclick="ShowGuideInfo(5);"  ><IMG border="0" src="../Images/info.gif"></a></span></td>
							</tr>
							<tr id="trLine71">
								<td>
								<span >How many</span> 
									<asp:RadioButton ID="radHalfPallet" Runat="server" Text=" Half Pallets spaces still available "
										GroupName="order" onclick="HandleExistingOrderOptionSelectionClick()"   Checked="True"></asp:RadioButton><asp:textbox id="txtHalfPallet" runat="server" maxlength="8" columns="8" onkeypress="NumberOnly(0)" CssClass="TextBoxNumber" /> <span style="FONT-WEIGHT: bold; COLOR: blue;font-size:11pt" > OR </span><asp:RadioButton ID="radVolume" Runat="server" Text=" what volume do you still need to fill "
										GroupName="order" onclick="HandleExistingOrderOptionSelectionClick()"></asp:RadioButton><asp:textbox id="txtExistingOrderVolume" runat="server" maxlength="10" columns="10" onkeyup="CheckFourDecimalNumber('txtExistingOrderVolume');" onkeypress="NumberOnly(1)"  CssClass="TextBoxNumber" /><span> <%= hidMeasUnit.value %></span> 
								</td>
							</tr>
							<tr id="trLine8">
								<td><span>Select Number and Size of Containers Ordered:&nbsp;</span><asp:textbox CssClass="TextBoxNumber" onkeypress="NumberOnly(0)" id="txtQty20Cont" runat="server" maxlength="3" columns="3" Width="35px"
										onkeyup="CalQty20Cont(this)"></asp:textbox><span>&nbsp;x 20' = </span>
									<asp:textbox id="txtVolumeUnit20" CssClass="TextBoxNumber" runat="server" maxlength="10" columns="8" ReadOnly="True"></asp:textbox>
									<%= hidMeasUnit.value %>
									<span>&nbsp;&nbsp; + &nbsp;&nbsp; </span>
									<asp:textbox CssClass="TextBoxNumber" onkeypress="NumberOnly(0)" id="txtQty40Cont" runat="server" maxlength="3" columns="3" Width="35px"
										onkeyup="CalQty40Cont(this)"></asp:textbox><span>&nbsp;x 40' = </span>
									<asp:textbox CssClass="TextBoxNumber" id="txtVolumeUnit40" runat="server" maxlength="10" columns="8" ReadOnly="True"></asp:textbox>
									<%= hidMeasUnit.value %>
									<span>&nbsp;&nbsp; + &nbsp;&nbsp; </span>
									<asp:textbox CssClass="TextBoxNumber" onkeypress="NumberOnly(0)" id="txtQty40HiCube" runat="server" maxlength="3" columns="3" Width="35px"
										onkeyup="CalQty40HiCube(this)"></asp:textbox><span>&nbsp;x 40'Hi Cube = </span>
									<asp:textbox CssClass="TextBoxNumber" id="txtVolumeUnit40HiCube" runat="server" maxlength="10" columns="8" ReadOnly="True"></asp:textbox>
									<%= hidMeasUnit.value %>
								</td>
							</tr>
							<tr id="trLine9">
								<td><span>Total Volume available:&nbsp;</span><asp:textbox id="txtTotalVolumeAvailable" CssClass="TextBoxNumber" runat="server" maxlength="10" columns="8" ReadOnly="True"></asp:textbox><span>&nbsp;<%= hidMeasUnit.value %></span></td>
							</tr>
							<tr id="trLine91">
								<td><span>Total Weight available:&nbsp;</span><asp:textbox id="txtTotalWeightAvailable" CssClass="TextBoxNumber" runat="server" maxlength="10" columns="8" ReadOnly="True"></asp:textbox>&nbsp;<%= GetMeasUnit() %></span></td>
							</tr>
							<tr id="trLine10" height="25">
								<td></td>
							</tr>
							<% if (GetFOBorHDHeader() = "HD") then %>
							<tr id="trLine111">
								<td><span><b>Country:</b> </span><asp:Label ID="lblCountry" Runat="server"></asp:Label>&nbsp;&nbsp;&nbsp;
								<span><b>Territory:</b> </span><asp:Label ID="lblTerritory" Runat="server"  ></asp:Label>
								</td>
							</tr>
							<tr id="trLine11">
								<td><span>For Home Delivered pricing the container <b>must</b> be full, either by 
										weight or Volume</span></td>
							</tr>
							<% end if%>
							<tr id="trLine12"> <!-- Shopping list -->
								<td>
								<div id="divOuter">
									<asp:datalist id="dlShoppingList" runat="server" gridlines="Both" cellpadding="1" width="100%"
											enableviewstate="true">
											<headertemplate>
												<table id="tblList" width="100%">
												<thead>
													<tr height="30px">
														<th class="CellWidth1">
															Item</th>
														<th class="CellWidth11">
															IDS Sort&nbsp;<a href="#" onclick="ShowGuideInfo(1);" ><IMG border="0" src="../Images/info.gif"></a></th>
														<th class="CellWidth2">
															Product Code</th>
														<th class="CellWidth3">
															Description</th>
														<th class="CellWidth4">
															Order Qty</th>
														<th class="CellWidth5">
															</th>
														<th class="CellWidth5">
															Units</th>
														<th class="CellWidth6">
															Unit Price</th>
														<th class="CellWidth7" >
															<%# GetFOBorHDHeader() %>
															Price
															&nbsp;<a href="#" onclick="ShowGuideInfo(2);" ><IMG border="0" src="../Images/info.gif"></a></th>
														<th class="CellWidth8">
															Priority&nbsp;<a href="#" onclick="ShowGuideInfo(3);"  ><IMG border="0" src="../Images/info.gif"></a></th>
														<th class="CellWidth9">
															Note&nbsp;<a href="#" onclick="ShowGuideInfo(4);"  ><IMG border="0" src="../Images/info.gif"></a></th>
														<th class="CellWidth10">
															Remove</th>
															<th class="CellWidth10">
															Weight</th>
															<th class="CellWidth10">
															Volume</th>
													</tr>
													</thead><tbody>
											</headertemplate>
											<Itemtemplate>
													<tr class="<%# GetRowClass(Container) %>">
														<td class="CellWidth1" align="right"><asp:TextBox CssClass="TextBoxNumber" BorderWidth="0" Runat="server" ID="ltrItemIndex" Width="100%" ReadOnly="True"></asp:TextBox></td>
														<td class="CellWidth11" align="right"><asp:TextBox CssClass="TextBoxNumber" BorderWidth="0" Runat="server" ID="ItemNo" Width="100%" ReadOnly="True"></asp:TextBox></td>
														<td class="CellWidth2"><%# DataBinder.Eval(Container.DataItem, "ProductCode")%></td>
														<td class="CellWidth3" nowrap style="word-wrap: break-word;width:180px"><%# DataBinder.Eval(Container.DataItem, "Description")%></td>
														<td class="CellWidth4" align="center">
															<asp:TextBox CssClass="TextBoxNumber" onkeypress="NumberOnly(0)" Runat="server" ID="OrderQty" Width="90%"></asp:TextBox>
														</td>
														<td class="CellWidth5"><%# DataBinder.Eval(Container.DataItem, "UnitDesc")%>
														</td>
														<td class="CellWidth5" style="text-align: right"  align="right"><%# DataBinder.Eval(Container.DataItem, "MinOrderQtyValue")%>
														</td>
														<td class="CellWidth6" align="right">
															<asp:TextBox CssClass="TextBoxNumber" BorderWidth="0" Runat="server" ID="UnitPrice" Width="100%" ReadOnly="True"></asp:TextBox>
														<td class="CellWidth7" align="right">
															<asp:TextBox CssClass="TextBoxNumber" BorderWidth="0" Runat="server" ID="Total" Width="100%" ReadOnly="True"></asp:TextBox></td>
														<td class="CellWidth8" align="center">
															<asp:DropDownList runat="server" ID="ddlPriority" Width="99%">
																<asp:ListItem Value="-1">--select--</asp:ListItem>
																<asp:ListItem Value="1">Increase</asp:ListItem>
																<asp:ListItem Value="2">Exact</asp:ListItem>
																<asp:ListItem Value="3">Reduce</asp:ListItem>
															</asp:DropDownList>  </td>
														<td class="CellWidth9" align="center"><a href="javascript:;"  onclick="openAddNotesDialog( <%# DataBinder.Eval(Container.DataItem, "ItemNo")%> )"> <span  id="linkAddNote" runat="server" >Add 
																notes</span></a></td>
														<td class="CellWidth10" align="center">
															<asp:linkbutton id="lnkRemove" Runat="server" OnCommand="lnkRemove_Command" CommandName="Remove" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "ItemNo") %>' >Remove</asp:linkbutton></td>
														<td class="CellWidth10" style="text-align: right" > <%# GetUnitWeightHTML(Container.DataItem)%> 
														</td>
														<td class="CellWidth10" style="text-align: right"  align="right"><%# GetMinQtyVolumeHTML(Container.DataItem)%> 
														</td>
													</tr>
											</Itemtemplate>
											<footertemplate>
											</tbody></table>
											</footertemplate>
										</asp:datalist>
									</div>
								</td>
							</tr>
							<tr>
								<td >
								<table id="tblList1" width="100%" border=0>
								<tr align=right>
												<td class="CellWidth1" align="right"></td>
														<td class="CellWidth11" align="right"></td>
														<td class="CellWidth2"></td>
														<td class="CellWidth3" width="200px"></td>
														<td class="CellWidth4" align="center">
														</td>
														<td class="CellWidth5" align="right">&nbsp;&nbsp;
														<asp:Label ID="lblToTalValue" Runat="server" >Total <%# GetFOBorHDHeader() %> Value:</asp:Label>
														</td>
														<td class="CellWidth7" align="right" style="padding-left:22px">&nbsp;&nbsp;
														<asp:textbox CssClass="TextBoxNumber" id="txtTotalPrice" runat="server" maxlength="10" columns="16"
														ReadOnly="True"></asp:textbox>
														</td>
														<td class="CellWidth7" align="right">
														<asp:button id="btnRecalculated" Runat="server" Text="Recalculated"></asp:button>
															</td>
														<td class="CellWidth8" align="center">
														
															</td>
														<td class="CellWidth9" align="center"></td>
														<td class="CellWidth10" align="center">
															</td>
														<td class="CellWidth10" style="text-align: right" >
														</td>
														<td class="CellWidth10" style="text-align: right"  align="right">
														</td>
													</tr>
								</table>
									</td>
							</tr>
							<tr id="trLine101" height="15">
								<td></td>
							</tr>
							<tr>
								<td></td>
							</tr>
							<tr>
								<td></td>
							</tr>
							<tr>
								<td style="PADDING-RIGHT: 10px" align="right">
									<table width="760" border="0" bordercolor="red">
										<tr>
											<td width="26%"><b><span>Total Volume Selected: </span></b></td>
											<td width="18%" align="left">
												<asp:textbox ReadOnly="True" CssClass="TextBoxNumber" id="txtSelectVolumeTotal" runat="server" maxlength="10" columns="8"></asp:textbox>&nbsp;<%= hidMeasUnit.value %></td>
											<td width="8%"><b><span>&nbsp;&nbsp;% Full: </span></b></td>
											<td width="10%" align="right">
												<asp:textbox ReadOnly="True"  CssClass="TextBoxNumber" id="txtPercentFull" runat="server" maxlength="10" columns="8"></asp:textbox></td>
										    <td width="17%"><b><span>&nbsp;&nbsp;Remaining Volume: </span></b></td>
											<td width="21%" align="left">
												<asp:textbox ReadOnly="True" CssClass="TextBoxNumber" id="txtRemainVolume" runat="server" maxlength="10" columns="8"></asp:textbox>&nbsp;<%= hidMeasUnit.value %></td>
										</tr>
									</table>
								</td>
							</tr>
							<tr>
								<td style="PADDING-RIGHT: 10px" align="right" valign=top>
									<table width="760" border="0" bordercolor="red" style="padding-bottom:2px"> 
										<tr height="20">
											<td width="26%"><b><span>Total Weight of Goods Selected: </span></b></td>
											<td width="18%" align="left">
												<asp:textbox ReadOnly="True" CssClass="TextBoxNumber" id="txtTotalGoodWeight" runat="server" maxlength="10" columns="8"></asp:textbox>&nbsp;<%= GetMeasUnit() %>&nbsp;&nbsp;
											</td>
											<td width="8%"><b><span id="lblPercentFull">&nbsp;&nbsp;% Full: </span></b></td>
											<td width="10%" align="right">
												<asp:textbox ReadOnly="True" CssClass="TextBoxNumber" id="txtGoodWeightPercentFull" runat="server" maxlength="10" columns="8"></asp:textbox>
											</td>
											<td width="17%"><b><span id="lblRemainingWeight">&nbsp;&nbsp;Remaining Weight: </span></b></td>
											<td width="12%">
												<asp:textbox ReadOnly="True" CssClass="TextBoxNumber" id="txtGoodWeightRemain" runat="server" maxlength="10" columns="8"></asp:textbox>
											</td>
											<td valign="top" style="padding-bottom:2px">&nbsp;<span id="lblMeasUnitGoodWeightRemain"><%= GetMeasUnit() %></span>&nbsp;&nbsp;</td>
										</tr>
									</table>
								</td>
							</tr>
							<tr id="trLine1011" height="15">
								<td></td>
							</tr>
							<tr>
								<td>
									<table cellpadding="0" cellspacing="0" width="87%" border=0>
									<tr>
										<td><asp:button id="btnBackToIDS" Runat="server" Text="Back" width="135px"></asp:button></td>
										<td><asp:button id="btnProceedOrder" Runat="server" Text="Proceed to Order"></asp:button></td>
										<td><span>
											By proceeding this does not yet commit you to this order, we will send you a 
											separate Sales Order Confirmation for this purpose.
											<br>
											You will receive an email confirmation of this selection.</span></td>
									</tr>
									<tr  valign="bottom">
										<td ><asp:button id="btnSaveYourList" Runat="server" Text="Save your list" width="135px" ></asp:button></td>
										<td colspan="2" valign="bottom" style="padding-top:5px" ><font style="FONT-SIZE: 11pt"> (Save your partly completed selection and complete it later)</font></td>
									</tr>
									<tr  valign="bottom">
										<td ><asp:button id="btnClearSavedList" Runat="server" Text="Delete your saved list" width="135px" ></asp:button></td>
										<td colspan="2" valign="bottom" style="padding-top:5px" >
									</tr>
									</table>
								</td>
							</tr>
						</TBODY>
					</table>
					<input id="hidMeasUnit" runat="server" type="hidden" value="cbm">
					<input id="hidRoadWeight" runat="server" type="hidden" value="1" NAME="hidRoadWeight">
					<input id="hid20C" runat="server" type="hidden" value="30" NAME="hid20C">
					<input id="hid40C" runat="server" type="hidden" value="60" NAME="hi40C">
					<input id="hid40HC" runat="server" type="hidden" value="70" NAME="hi40HC">
			</div>
		</div>
		</form>
	</body>
</HTML>
